import { ApiProperty } from '@nestjs/swagger';
import { IsEmail, IsNotEmpty, MaxLength, MinLength } from 'class-validator';

export class RegisterDto {
  @IsNotEmpty({ message: '用户名为必填' })
  @ApiProperty()
  username: string;

  @IsNotEmpty({ message: '密码为必填' })
  @MinLength(6, { message: '密码不得低于6位' })
  @ApiProperty()
  password: string;

  @IsNotEmpty({ message: '昵称为必填' })
  @MaxLength(20, { message: `昵称最大长度是$constraint1` })
  @ApiProperty()
  nickName: string;

  @IsNotEmpty({ message: '邮箱为必填' })
  @IsEmail({}, { message: '不合法的邮箱' })
  @ApiProperty()
  email: string;

  @IsNotEmpty({ message: '验证码为必填' })
  @ApiProperty()
  captcha: string;
}
